<template>
  <div class="son">
    <!-- -->
    <button @click="addFatherFun()">添加全局事件总线</button>
  </div>
</template>

<script>
export default {
  name: 'AppSon',

  data() {
    return {
      
    };
  },

  mounted() {
    
  },

  methods: {
    addFatherFun(){
        this.$bus.$on("showName",function() {
            alert("全局事件总线触发了")
        })
    }
  },
};
</script>

<style scoped>
.son{
    width: 50px;
    height: 50px;
    background-color: blueviolet;
}

</style>